<script>
    import UserItemList from "./UserItemList.html";

    function processItems(pi) {
       let p1 = pi[1];
       p1.name = p1.title;
       p1.ord = pi[0].ord;
       return p1; 
    }
    function processItemCallback(pi) {
       let p0 = pi[1];
       p0.name = p0.title;
       return [pi[0],p0]; 
    }
    function itemInfoExtractCallback(item){
        let itemInfo = {
            title : item[1].name
          , description : item[1].description
          , body : item[1].body
          , format : item[1].format
        };
        let userItemInfo = {
            permissions : item[0].permissions
          , ord : item[0].ord
          , url : item[0].url
        };
        return [itemInfo,userItemInfo];
    };
</script>
<style>
a {
    flex-grow: 1;
    color: var(--fg-color-3);
}
</style>
<UserItemList 
    itemUrl="posts" 
    itemNamePlural="posts"
    itemNameSingular="post"
    on:orderChanged
    on:orderSubmitted 
    {processItems} 
    {processItemCallback} 
    {itemInfoExtractCallback} 
    /> 
